package com.firstsource.networking.ip.tracker.data.entities;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Entity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

@Entity
@Table(name="locations")
public class Location implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="idx")
	@GeneratedValue(generator="LocationIndexSequence")
	@GenericGenerator(
				name="LocationIndexSequence",
				strategy="seqhilo",
				parameters={
						@Parameter(name="max_lo", value="1"),
						@Parameter(name="sequence", value="location_idx_seq")
				}
			)
	private int idx = 0 ;

	@Column(name="name")
	private String name ;

	@Column(name="strAddr1")
	private String streetAddr1 ;

	@Column(name="strAddr2")
	private String streetAddr2 ;

	@Column(name="strAddr3")
	private String streetAddr3 ;

	@Column(name="city")
	private String city ;

	@Column(name="state")
	private String state ;

	@Column(name="zip")
	private String zip ;

	@Column(name="latitude")
	private String latitude = null ;

	@Column(name="longitude")
	private String longitude = null ;

	@Column(name="vertical")
	private String vertical ;

	@OneToMany(mappedBy="location")
	private Set<Host> hosts = null ;

	@OneToMany(mappedBy="location")
	private Set<Subnet> subnets = null ;

	@OneToMany(mappedBy="location")
	private Set<VLAN> vlans = null ;

	/**
	 * @return the idx
	 */
	public int getIdx() {
		return idx;
	}

	/**
	 * @param idx the idx to set
	 */
	public void setIdx(int idx) {
		this.idx = idx;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the streetAddr1
	 */
	public String getStreetAddr1() {
		return streetAddr1;
	}

	/**
	 * @param streetAddr1 the streetAddr1 to set
	 */
	public void setStreetAddr1(String streetAddr1) {
		this.streetAddr1 = streetAddr1;
	}

	/**
	 * @return the streetAddr2
	 */
	public String getStreetAddr2() {
		return streetAddr2;
	}

	/**
	 * @param streetAddr2 the streetAddr2 to set
	 */
	public void setStreetAddr2(String streetAddr2) {
		this.streetAddr2 = streetAddr2;
	}

	/**
	 * @return the streetAddr3
	 */
	public String getStreetAddr3() {
		return streetAddr3;
	}

	/**
	 * @param streetAddr3 the streetAddr3 to set
	 */
	public void setStreetAddr3(String streetAddr3) {
		this.streetAddr3 = streetAddr3;
	}

	/**
	 * @return the city
	 */
	public String getCity() {
		return city;
	}

	/**
	 * @param city the city to set
	 */
	public void setCity(String city) {
		this.city = city;
	}

	/**
	 * @return the state
	 */
	public String getState() {
		return state;
	}

	/**
	 * @param state the state to set
	 */
	public void setState(String state) {
		this.state = state;
	}

	/**
	 * @return the zip
	 */
	public String getZip() {
		return zip;
	}

	/**
	 * @param zip the zip to set
	 */
	public void setZip(String zip) {
		this.zip = zip;
	}

	/**
	 * @return the vertical
	 */
	public String getVertical() {
		return vertical;
	}

	/**
	 * @param vertical the vertical to set
	 */
	public void setVertical(String vertical) {
		this.vertical = vertical;
	}

	public void setHosts(Set<Host> hosts) {
		this.hosts = hosts;
	}

	public Set<Host> getHosts() {
		return hosts;
	}

	public void setSubnets(Set<Subnet> subnets) {
		this.subnets = subnets;
	}

	public Set<Subnet> getSubnets() {
		return subnets;
	}

	public void setVlans(Set<VLAN> vlans) {
		this.vlans = vlans;
	}

	public Set<VLAN> getVlans() {
		return vlans;
	}

	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}

	public String getLatitude() {
		return latitude;
	}

	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}

	public String getLongitude() {
		return longitude;
	}
}
